<link rel="stylesheet" type="text/css" href="../style/css/style.css" media="screen" />
<?php
session_start();
header("Content-type: application/msexcel");
header("Content-Disposition: attachment; filename=Extrato.xls");
echo"<table width='100%' border='0'>
        <tr>
        <td><h3>Entradas:</h3></td>
        <td><h3>Sa&iacute;das:</h3></td>
        <td><h3>Subtotal:</h3></td>
        <td><h3>Descri&ccedil;&atilde;o:</h3></td>
        <td><h3>Categoria:</h3></td>
        <td><h3>Respons&aacute;vel:</h3></td>
        <td><h3>Data:</h3></td>
        <td><h3>Hora:</h3></td>
        </tr>";

foreach ($_SESSION[xml] as $i => $value) {
    echo "
        <tr " . ($i % 2 == 0 ? "class='linha1'" : "class='linha2'") . " >
        <td>$value[entrada]</td>
        <td>$value[saida]</td>
        <td>" . ($value[total] < 0 ? "<div class='devedor'>$value[total]</div>" :
            "<div class='positivo'>$value[total]</div>") . "</td>
        <td>".utf8_decode($value[produto])."</td>
        <td>".utf8_decode($value[categoria])."</td>
        <td>".utf8_decode($value[usuario])."</td>
        <td>$value[data]</td>
        <td>$value[hora]</td> </tr>";
}
echo "<tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td><h3>TOTAL: " . $_SESSION[xml_total] . "</h3></td>
        </tr></table>";
$_SESSION[xml]="";
$_SESSION[xml_total]="";
$_SESSION[xml_data]="";
?>
